package com.hlk.file;

import com.hlk.pojo.bo.NewAdminBO;
import com.hlk.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author hlk
 * @version 1.0
 * @date 2020-12-15 15:43
 */
@Api(value = "文件controller", tags = {"文件controller"})
@RequestMapping("fs")
public interface FileUploadControllerApi {

    @PostMapping("uploadFace")
    @ApiOperation(value = "上传头像")
    Result uploadFace(@RequestParam String userId, MultipartFile file) throws Exception;

    @PostMapping("/uploadToGridFS")
    @ApiOperation(value = "文件上传到mongodb的gridfs中")
    Result uploadToGridFS(@RequestBody NewAdminBO newAdminBO) throws Exception;

    @GetMapping("/readInGridFS")
    @ApiOperation(value = "从gridfs中读取图片内容")
    void readInGridFS(String faceId, HttpServletRequest request, HttpServletResponse response) throws Exception;

    @GetMapping("/readFace64InGridFS")
    @ApiOperation(value = "从gridfs中读取图片内容，并且返回base64")
    Result readFace64InGridFS(String faceId, HttpServletRequest request, HttpServletResponse response) throws Exception;

    @PostMapping("/uploadSomeFiles")
    @ApiOperation(value = "多文件上传")
    Result uploadSomeFiles(@RequestParam String userId, MultipartFile[] files) throws Exception;

}
